Lesson: 13 - Loop (Repeat and Repeat Until)

Purpose : Students learn the concept of looping through repeat and repeat until.

Materials Required

Scratch 3.0, and Blockly game.

Curriculum Content 5.4) Loops, 6.12) Variables

Prior knowledge

Knowledge of X and Y axes, prime numbers. Completed unplugged activities in lesson 10 and have an idea of looping.

Exercises

Exercise:1



  1. Write a code in which the sprite will ask the user to enter a number. The program will then check if the number is a prime number or not and display the result.

  2. Click here to see a video about what is prime number?


    Exercise video:



    See the video for your reference.


    Exercise:2



  3. A man walks from left to right. If the man reaches the x-axis greater than 200 change the backdrop.

  4. Exercise video:



    See the video for your reference.


    Exercise:3



  5. Write a scratch code in which the computer selects a random number between some boundaries in its memory and the user has to find the number. The program will end when you find the correct number. Use the repeat until block.

  6. Exercise video:



    See the video for your reference.


Solutions



  • Click here to download the sb3 file for exercise-1.

  • Click here to download the sb3 file for exercise-2.

  • Click here to download the sb3 file for exercise-3.


  • Teacher's Instruction
    1. Emphasise that the students are learning loops.
    2. Students should play the Dice game in Lesson 10 before trying the exercises.
    3. Teachers should use technical programming words like conditions, loop, code, variable etc.
    4. In the variant where the computer tells whether the correct answer is above or below the guess, ask the students to think about how they can guess with the smallest number of guesses if the number is between 1 and 100. Introduce them to the idea of Binary search. For older children you can also ask them to think about how many guesses it will take to find a number between 1 and N. 2^(no of steps) >N. i.e. Log(N) steps.
    5. Teachers should help to complete the exercise-3 because this exercise will be developed in further lessons.